package com.hf.mapper;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hf.entity.Sign;

/**
 * <p>
 * Mapper 接口
 * </p>
 *
 * @author eight
 * @since 2021-06-06
 */
public interface SignMapper extends BaseMapper<Sign> {
	/**
	 * 根据用户id和当前时间判断用户当天是否签到，如果没有签到，则不能签退
	 * 
	 * @param userId
	 * @param signOnTime
	 * @return
	 */
	@Select("select * from sign where user_id=#{userId} and sign_on_time=#{signOnTime}")
	public Sign getSignByUserIdAndTime(@Param("userId") Integer userId, @Param("signOnTime") String signOnTime);

	/**
	 * 签退
	 * 
	 * @param userId
	 * @param signOffTime
	 * @return
	 */
	@Update("update sign set is_signoff='已签退',sign_off_time=#{signOffTime} where user_id=#{userId}")
	public boolean updateQianTui(@Param("userId") Integer userId, @Param("signOffTime") String signOffTime);


}
